<?php
    class Page_model extends Model {

        function __construct() {
            parent::Model();
            $this->load->library('Tree', array('table' => 'tree'));
        }

        function getPage($id) {
            $cond = array(
                'id' => $id,
                'active' => 1
            );
            return $this->tree->getNodesWhere($cond);
        }

        function getDefaultPage() {
            $cond = array(
                'active' => 1,
                'is_default' => 1,
            );
            return $this->tree->getNodesWhere($cond);
        }

        function getAllPages() {
            $tree = $this->tree->getAll();
            return $tree;
        }
    }
?>